from . import db
import datetime
import time


class Order(db.Model):
    id = db.Column(db.Integer, primary_key=True, autoincrement=True)
    order_id = db.Column(db.String(256), default=(int(time.time())))
    title = db.Column(db.String(80), doc="电影名", default="")
    ticket_code = db.Column(db.String(80), doc="取票码", default="")
    check_code = db.Column(db.String(80), doc="验证码", default="")
    pirce = db.Column(db.Integer, default=0, doc="订单价格")
    site = db.Column(db.JSON, default=[], doc="场次")
    cinema = db.Column(db.String(80), default="", doc="电影院名")
    create_date = db.Column(db.DateTime, doc="下单时间", default=datetime.datetime.utcnow())
    user_id = db.Column(db.Integer, db.ForeignKey("f_user.id", ondelete="CASCADE"))

    __tablename__ = "f_order"
